using System.Runtime.Serialization;
using VideoStore.Common.Response.Interface;

namespace VideoStore.Common.Response
{
    /// <summary>
    /// The Error class is used to represent the errors that have occurred with
    /// the request. The services should catch all the exceptions and return a 
    /// response object.
    /// </summary>
    [DataContract]
    public class Error : IError
    {
        #region Fields

        /// <summary>
        /// Name of the Error
        /// </summary>
        [DataMember]
        public string Name { get; set; }

        /// <summary>
        /// Description of the Error
        /// </summary>
        [DataMember]
        public string Description { get; set; }

        #endregion

        #region Constructor

        /// <summary>
        /// Default Constuctor
        /// </summary>
        public Error()
        {
            Name = string.Empty;
            Description = string.Empty;
        }

        /// <summary>
        /// Error constructor
        /// </summary>
        /// <param name="name">Name of the Error</param>
        public Error(string name)
        {
            Name = name;
        }

        /// <summary>
        /// Error Constructor
        /// </summary>
        /// <param name="name">Name of the error</param>
        /// <param name="description">Description of the error</param>
        public Error(string name, string description)
            : this(name)
        {
            Description = description;
        }

        #endregion
    }
}